package com.campus.happy;

import java.util.ArrayList;

import com.example.campus.R;

import android.content.Context;
import android.graphics.BitmapFactory;
import android.graphics.LinearGradient;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

public class InfoAdapter  extends BaseAdapter{
	ArrayList<Info>info;
	Context context;
	public InfoAdapter(Context context,ArrayList<Info>info)
	{
		this.context=context;
		this.info=info;
	}
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return info.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		View view=LayoutInflater.from(context).inflate(R.layout.onepic, null);
	    
		ImageView img=(ImageView)view.findViewById(R.id.img);
		TextView name=(TextView)view.findViewById(R.id.title);
		TextView addr=(TextView)view.findViewById(R.id.comment);
        name.setText(info.get(position).name);
		addr.setText(info.get(position).addr);
		
		img.setTag(info.get(position).r);
		Load.down(img,info.get(position).r);
//		LinearLayout view=new LinearLayout(context);
//		NetImg img=new NetImg(context,info.get(position).r);
//		TextView title=new TextView(context);
//		TextView addr=new TextView(context);
//		view.addView(img);
//		view.addView(title);
//		view.addView(addr);
//		img.setTag(info.get(position).r);
//		img.go();
//		title.setText(info.get(position).name);
//		
//		addr.setText(info.get(position).addr);
		return view;
	}

}
